package Base.基本的三种创建方法;

/**
 * @author 陈鹏
 * 
 */
public class RunnableTest {
    public static void main(String[] args) {
        TicketWindow2 tw2=new TicketWindow2();
        new Thread(tw2,"窗口1").start();
        new Thread(tw2,"窗口2").start();
        new Thread(tw2,"窗口3").start();
        new Thread(tw2,"窗口4").start();

    }
}

class TicketWindow2 implements Runnable{
    private int tickets=10000;
    @Override
    public void run() {
        while (true){
            if (tickets>0){
                System.out.println(Thread.currentThread().getName()+"正在出售第"+tickets--+"张票");
            }
        }
    }
}
